﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;
using DynamicDNS.Wcf;
using System.ServiceModel;

namespace DynamicDNS.Service
{
    public partial class UpdaterService : ServiceBase
    {
        internal static ServiceHost ConfigurationServiceHost = null;
        public UpdaterService()
        {
            InitializeComponent();
        }

        protected override void OnStart(string[] args)
        {
            if (ConfigurationServiceHost != null)
                ConfigurationServiceHost.Close();
            ConfigurationServiceHost = new ServiceHost(ConfigurationService.Instance);
            ConfigurationServiceHost.Open();
        }

        protected override void OnStop()
        {
            if(ConfigurationServiceHost != null)
            {
                ConfigurationServiceHost.Close();
                ConfigurationServiceHost = null;
            }
        }
    }
}
